import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        storel: '我是xuex里面的store1数据',
        token: '',
        mobile: '',
        city: '上海',
        count: 0,
        cinemaid: '310100',
        usermobile: '未知哦 ',

    },
    //很强的要改变数据的意愿  所以叫做突变  墨迹的不要！！！

    mutations: {

        add2(state, step) {
            console.log('我进入mutations里面了add2');
            console.log('sted', step);
            console.log('state', state);
            state.city = step;
            console.log(state.city);
            state.count = state.count + step;
            console.log(state.count);
        },
        cinemaidadd(state, step) {
            console.log('进入cinemaiddadd里了');
            state.cinemaid = step
        },
        usermobile(state, step) {
            console.log('进入usermobile里面了')
            state.usermobile = step
        },
        tokenadd(state, step) {
            console.log('进入vuextokenadd里面了');
            state.token = step

        },


    },
    //墨迹 异步的到这里
    actions: {
        action1(context, step) {
            console.log("进入actions里面了");
            console.log(context);
            console.log(step);
            setTimeout(() => {
                context.commit("add", step);
            }, 5000);
        },
    },
    getters: {
        getCount: function(state) {
            return '我要加点字符串' + state.count
        }
    }
});